package com.school;

import java.util.Scanner;

public class Test2Case2 {
    public static void main(String[] args) {
        /*给定两个字符串A和B
         * A的旋转操作将最左边的字符移动到最右边
         * 若在若干次调整之后，A能变成B，那么返回True
         * 否则返回False*/
        String A, B;
        Scanner sc = new Scanner(System.in);
        A = sc.next();
        B = sc.next();
        boolean flage=check(A,B);
        System.out.println(flage);


    }


    public static boolean check(String A,String B){
        for (int i = 0; i <A.length() ; i++) {
            A=move(A);
            if(A.equals(B)){
                return true;
            }
        }
        return false;
    }
    public static String move(String A) {
       //第二种方法，把字符串变为字符数组
        char[] arr=A.toCharArray();
        char first=arr[0];
        for (int i = 1; i <A.length() ; i++) {
            arr[i-1]=arr[i];
        }
        arr[A.length()-1]=first;
        //再利用字符数组创建字符串
        String result=new String(arr);
        return result;
    }

}